<template>
  <div class="config-list">
    <el-radio-group v-model="type">
      <div class="item">
        <el-radio label="TYPE_EVERY" class="choice" :disabled="disabled">每秒</el-radio>
      </div>
      <div class="item">
        <el-radio label="TYPE_RANGE" class="choice" :disabled="disabled">区间</el-radio>
        <span class="item-text">从</span>
        <el-input-number v-model="valueRange.start" :disabled="type!==TYPE_RANGE || disabled" :max="maxValue" :min="minValue" :precision="0" class="w120" />
        <span class="item-text">秒至</span>
        <el-input-number v-model="valueRange.end" :disabled="type!==TYPE_RANGE || disabled" :max="maxValue" :min="minValue" :precision="0" class="w120" />
        <span class="item-text">秒</span>
      </div>
      <div class="item">
        <el-radio label="TYPE_LOOP" class="choice" :disabled="disabled">循环</el-radio>
        <el-input-number v-model="valueLoop.start" :disabled="type!==TYPE_LOOP || disabled" :max="maxValue" :min="minValue" :precision="0" class="w120" />
        <span class="item-text">秒开始，间隔</span>
        <el-input-number v-model="valueLoop.interval" :disabled="type!==TYPE_LOOP || disabled" :max="maxValue" :min="minValue" :precision="0" class="w120" />
        <span class="item-text">秒</span>
      </div>
      <div class="item">
        <el-radio label="TYPE_SPECIFY" class="choice" :disabled="disabled">指定</el-radio>
        <div class="list">
          <el-checkbox-group v-model="valueList">
            <template v-for="i in specifyRange">
              <el-checkbox :key="`key-${i}`" class="list-check-item" :label="i" :disabled="type!==TYPE_SPECIFY || disabled">{{ i }}</el-checkbox>
            </template>
          </el-checkbox-group>
        </div>
      </div>
    </el-radio-group>
  </div>
</template>

<script>
import mixin from './mixin'

export default {
  name: 'Second',
  mixins: [mixin],
  data() {
    return {}
  },
  watch: {
    value_c(newVal, oldVal) {
      this.$emit('change', newVal)
    }
  },
  created() {
    this.DEFAULT_VALUE = '*'
    this.minValue = 0
    this.maxValue = 59
    this.valueRange.start = 0
    this.valueRange.end = 59
    this.valueLoop.start = 0
    this.valueLoop.interval = 1
    // console.info('created')
    this.parseProp(this.prop)
  }
}
</script>

<style lang="scss" scoped>
  @import "mixin.scss";
</style>
